import { IPSSystem } from '../ipssystem';
import { IPSDataEntity } from '../dataentity/ipsdata-entity';
import { IPSDEMethodDTO } from '../dataentity/service/ipsdemethod-dto';
import { IPSSysMethodDTO } from './ipssys-method-dto';
import { IPSSysMethodDTOField } from './ipssys-method-dtofield';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSysMethodDTOFieldImpl extends PSModelObjectImpl implements IPSSysMethodDTOField {
  get codeName(): string {
    return this.M.codeName;
  }

  get defaultValue(): string {
    return this.M.defaultValue;
  }

  get defaultValueType(): string {
    return this.M.defaultValueType;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get fieldTag(): string {
    return this.M.fieldTag;
  }

  get fieldTag2(): string {
    return this.M.fieldTag2;
  }

  get jsonFormat(): string {
    return this.M.jsonFormat;
  }

  get logicName(): string {
    return this.M.logicName;
  }

  get maxValueString(): string {
    return this.M.maxValueString;
  }

  get memo(): string {
    return this.M.memo;
  }

  get minStringLength(): number {
    return this.M.minStringLength != null ? this.M.minStringLength : 0;
  }

  get minValueString(): string {
    return this.M.minValueString;
  }

  get name(): string {
    return this.M.name;
  }

  get orderValue(): number {
    return this.M.orderValue != null ? this.M.orderValue : 99999;
  }

  get precision(): number {
    return this.M.precision != null ? this.M.precision : 0;
  }

  protected refpsdemethoddto: IPSDEMethodDTO | null = null;

  getRefPSDEMethodDTO(): IPSDEMethodDTO | null {
    if (this.refpsdemethoddto != null) return this.refpsdemethoddto;
    const value = this.M.getRefPSDEMethodDTO;
    if (value == null) {
      return null;
    }
    this.refpsdemethoddto = this.getPSModel4('dataentity.service.IPSDEMethodDTO', value, 'getRefPSDEMethodDTO') as IPSDEMethodDTO;
    return this.refpsdemethoddto;
  }

  get refPSDEMethodDTO(): IPSDEMethodDTO | null {
    return this.getRefPSDEMethodDTO();
  }

  getRefPSDEMethodDTOMust(): IPSDEMethodDTO {
    const value = this.getRefPSDEMethodDTO();
    if (value == null) {
      throw new Error('未指定引用实体方法DTO对象');
    }
    return value;
  }

  protected refpsdataentity: IPSDataEntity | null = null;

  getRefPSDataEntity(): IPSDataEntity | null {
    if (this.refpsdataentity != null) return this.refpsdataentity;
    const value = this.M.getRefPSDataEntity;
    if (value == null) {
      return null;
    }
    this.refpsdataentity = this.getPSModel4('dataentity.IPSDataEntity', value, 'getRefPSDataEntity') as IPSDataEntity;
    return this.refpsdataentity;
  }

  get refPSDataEntity(): IPSDataEntity | null {
    return this.getRefPSDataEntity();
  }

  getRefPSDataEntityMust(): IPSDataEntity {
    const value = this.getRefPSDataEntity();
    if (value == null) {
      throw new Error('未指定引用实体对象');
    }
    return value;
  }

  protected refpssysmethoddto: IPSSysMethodDTO | null = null;

  getRefPSSysMethodDTO(): IPSSysMethodDTO | null {
    if (this.refpssysmethoddto != null) return this.refpssysmethoddto;
    const value = this.M.getRefPSSysMethodDTO;
    if (value == null) {
      return null;
    }
    const ipssystem = this.getParentPSModelObject('IPSSystem') as IPSSystem;
    if (ipssystem != null) {
      this.refpssysmethoddto = ipssystem.findPSSysMethodDTO(value);
    }
    return this.refpssysmethoddto;
  }

  get refPSSysMethodDTO(): IPSSysMethodDTO | null {
    return this.getRefPSSysMethodDTO();
  }

  getRefPSSysMethodDTOMust(): IPSSysMethodDTO {
    const value = this.getRefPSSysMethodDTO();
    if (value == null) {
      throw new Error('未指定引用系统方法DTO对象');
    }
    return value;
  }

  get sourceType(): 'DEFIELD' | 'DEFGROUPDETAIL' | 'DER' | 'DYNAMODELATTR' | 'DEACTIONPARAM' | 'DEFSEARCHMODE' | 'DEDATASETPARAM' {
    return this.M.sourceType;
  }

  get stdDataType(): 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 {
    return this.M.stdDataType != null ? this.M.stdDataType : 0;
  }

  get stringLength(): number {
    return this.M.stringLength != null ? this.M.stringLength : 0;
  }

  get type(): 'SIMPLE' | 'SIMPLES' | 'DTO' | 'DTOS' {
    return this.M.type;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get allowEmpty(): boolean {
    return this.M.allowEmpty != null ? this.M.allowEmpty : true;
  }

  get readOnly(): boolean {
    return this.M.readOnly != null ? this.M.readOnly : false;
  }

  get cls(): string {
    return 'PSSysMethodDTOFieldImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'IPSModelObject' || cls == 'IPSModelSortable' || cls == 'IPSObject' || cls == 'service.IPSSysMethodDTOField') return true;
    return super.instanceof(cls);
  }
}
